using UnityEngine;
using UnityEngine.UI;

namespace MaterialUI
{
	[AddComponentMenu("MaterialUI/Material Screen", 100)]
	public class MaterialScreen : MonoBehaviour
	{
		[SerializeField]
		private bool m_OptionsControlledByScreenView = true;

		[SerializeField]
		private bool m_DisableWhenNotVisible = true;

		[SerializeField]
		private bool m_FadeIn = true;

		[SerializeField]
		private Tween.TweenType m_FadeInTweenType = Tween.TweenType.EaseOutQuint;

		[SerializeField]
		private float m_FadeInAlpha;

		[SerializeField]
		private AnimationCurve m_FadeInCustomCurve;

		[SerializeField]
		private bool m_ScaleIn;

		[SerializeField]
		private Tween.TweenType m_ScaleInTweenType = Tween.TweenType.EaseOutQuint;

		[SerializeField]
		private float m_ScaleInScale;

		[SerializeField]
		private AnimationCurve m_ScaleInCustomCurve;

		[SerializeField]
		private bool m_SlideIn;

		[SerializeField]
		private Tween.TweenType m_SlideInTweenType = Tween.TweenType.EaseOutQuint;

		[SerializeField]
		private ScreenView.SlideDirection m_SlideInDirection = ScreenView.SlideDirection.Right;

		[SerializeField]
		private bool m_AutoSlideInAmount = true;

		[SerializeField]
		private float m_SlideInAmount;

		[SerializeField]
		private float m_SlideInPercent = 100f;

		[SerializeField]
		private AnimationCurve m_SlideInCustomCurve;

		[SerializeField]
		private bool m_RippleIn;

		[SerializeField]
		private Tween.TweenType m_RippleInTweenType = Tween.TweenType.EaseOutQuint;

		[SerializeField]
		private ScreenView.RippleType m_RippleInType;

		[SerializeField]
		private Vector2 m_RippleInPosition;

		[SerializeField]
		private AnimationCurve m_RippleInCustomCurve;

		[SerializeField]
		private bool m_FadeOut;

		[SerializeField]
		private Tween.TweenType m_FadeOutTweenType = Tween.TweenType.EaseOutQuint;

		[SerializeField]
		private float m_FadeOutAlpha;

		[SerializeField]
		private AnimationCurve m_FadeOutCustomCurve;

		[SerializeField]
		private bool m_ScaleOut;

		[SerializeField]
		private Tween.TweenType m_ScaleOutTweenType = Tween.TweenType.EaseOutQuint;

		[SerializeField]
		private float m_ScaleOutScale;

		[SerializeField]
		private AnimationCurve m_ScaleOutCustomCurve;

		[SerializeField]
		private bool m_SlideOut;

		[SerializeField]
		private Tween.TweenType m_SlideOutTweenType = Tween.TweenType.EaseOutQuint;

		[SerializeField]
		private ScreenView.SlideDirection m_SlideOutDirection;

		[SerializeField]
		private bool m_AutoSlideOutAmount = true;

		[SerializeField]
		private float m_SlideOutAmount;

		[SerializeField]
		private float m_SlideOutPercent = 100f;

		[SerializeField]
		private AnimationCurve m_SlideOutCustomCurve;

		[SerializeField]
		private bool m_RippleOut;

		[SerializeField]
		private Tween.TweenType m_RippleOutTweenType = Tween.TweenType.EaseOutQuint;

		[SerializeField]
		private ScreenView.RippleType m_RippleOutType;

		[SerializeField]
		private Vector2 m_RippleOutPosition;

		[SerializeField]
		private AnimationCurve m_RippleOutCustomCurve;

		[SerializeField]
		private float m_TransitionDuration = 0.5f;

		private RectTransform m_Ripple;

		private ScreenView m_ScreenView;

		private RectTransform m_RectTransform;

		private CanvasGroup m_CanvasGroup;

		[SerializeField]
		private int m_ScreenIndex = -1;

		private int m_IsTransitioning;

		private float m_TransitionStartTime;

		private float m_TransitionDeltaTime;

		private Vector2 m_TempRippleSize;

		private Vector3 m_TempRippleScale;

		private Vector3 m_TargetRipplePos;

		private Vector3 m_CurrentRipplePos;

		private Vector3 m_TempScreenPos;

		private Vector2 m_SlideScreenPos;

		public bool optionsControlledByScreenView
		{
			get
			{
				return m_OptionsControlledByScreenView;
			}
			set
			{
				m_OptionsControlledByScreenView = value;
			}
		}

		public bool disableWhenNotVisible
		{
			get
			{
				return m_DisableWhenNotVisible;
			}
			set
			{
				m_DisableWhenNotVisible = value;
			}
		}

		public bool fadeIn
		{
			get
			{
				return m_FadeIn;
			}
			set
			{
				m_FadeIn = value;
			}
		}

		public Tween.TweenType fadeInTweenType
		{
			get
			{
				return m_FadeInTweenType;
			}
			set
			{
				m_FadeInTweenType = value;
			}
		}

		public float fadeInAlpha
		{
			get
			{
				return m_FadeInAlpha;
			}
			set
			{
				m_FadeInAlpha = value;
			}
		}

		public AnimationCurve fadeInCustomCurve
		{
			get
			{
				return m_FadeInCustomCurve;
			}
			set
			{
				m_FadeInCustomCurve = value;
			}
		}

		public bool scaleIn
		{
			get
			{
				return m_ScaleIn;
			}
			set
			{
				m_ScaleIn = value;
			}
		}

		public Tween.TweenType scaleInTweenType
		{
			get
			{
				return m_ScaleInTweenType;
			}
			set
			{
				m_ScaleInTweenType = value;
			}
		}

		public float scaleInScale
		{
			get
			{
				return m_ScaleInScale;
			}
			set
			{
				m_ScaleInScale = value;
			}
		}

		public AnimationCurve scaleInCustomCurve
		{
			get
			{
				return m_ScaleInCustomCurve;
			}
			set
			{
				m_ScaleInCustomCurve = value;
			}
		}

		public bool slideIn
		{
			get
			{
				return m_SlideIn;
			}
			set
			{
				m_SlideIn = value;
			}
		}

		public Tween.TweenType slideInTweenType
		{
			get
			{
				return m_SlideInTweenType;
			}
			set
			{
				m_SlideInTweenType = value;
			}
		}

		public ScreenView.SlideDirection slideInDirection
		{
			get
			{
				return m_SlideInDirection;
			}
			set
			{
				m_SlideInDirection = value;
			}
		}

		public bool autoSlideInAmount
		{
			get
			{
				return m_AutoSlideInAmount;
			}
			set
			{
				m_AutoSlideInAmount = value;
			}
		}

		public float slideInAmount
		{
			get
			{
				return m_SlideInAmount;
			}
			set
			{
				m_SlideInAmount = value;
			}
		}

		public float slideInPercent
		{
			get
			{
				return m_SlideInPercent;
			}
			set
			{
				m_SlideInPercent = value;
			}
		}

		public AnimationCurve slideInCustomCurve
		{
			get
			{
				return m_SlideInCustomCurve;
			}
			set
			{
				m_SlideInCustomCurve = value;
			}
		}

		public bool rippleIn
		{
			get
			{
				return m_RippleIn;
			}
			set
			{
				m_RippleIn = value;
			}
		}

		public Tween.TweenType rippleInTweenType
		{
			get
			{
				return m_RippleInTweenType;
			}
			set
			{
				m_RippleInTweenType = value;
			}
		}

		public ScreenView.RippleType rippleInType
		{
			get
			{
				return m_RippleInType;
			}
			set
			{
				m_RippleInType = value;
			}
		}

		public Vector2 rippleInPosition
		{
			get
			{
				return m_RippleInPosition;
			}
			set
			{
				m_RippleInPosition = value;
			}
		}

		public AnimationCurve rippleInCustomCurve
		{
			get
			{
				return m_RippleInCustomCurve;
			}
			set
			{
				m_RippleInCustomCurve = value;
			}
		}

		public bool fadeOut
		{
			get
			{
				return m_FadeOut;
			}
			set
			{
				m_FadeOut = value;
			}
		}

		public Tween.TweenType fadeOutTweenType
		{
			get
			{
				return m_FadeOutTweenType;
			}
			set
			{
				m_FadeOutTweenType = value;
			}
		}

		public float fadeOutAlpha
		{
			get
			{
				return m_FadeOutAlpha;
			}
			set
			{
				m_FadeOutAlpha = value;
			}
		}

		public AnimationCurve fadeOutCustomCurve
		{
			get
			{
				return m_FadeOutCustomCurve;
			}
			set
			{
				m_FadeOutCustomCurve = value;
			}
		}

		public bool scaleOut
		{
			get
			{
				return m_ScaleOut;
			}
			set
			{
				m_ScaleOut = value;
			}
		}

		public Tween.TweenType scaleOutTweenType
		{
			get
			{
				return m_ScaleOutTweenType;
			}
			set
			{
				m_ScaleOutTweenType = value;
			}
		}

		public float scaleOutScale
		{
			get
			{
				return m_ScaleOutScale;
			}
			set
			{
				m_ScaleOutScale = value;
			}
		}

		public AnimationCurve scaleOutCustomCurve
		{
			get
			{
				return m_ScaleOutCustomCurve;
			}
			set
			{
				m_ScaleOutCustomCurve = value;
			}
		}

		public bool slideOut
		{
			get
			{
				return m_SlideOut;
			}
			set
			{
				m_SlideOut = value;
			}
		}

		public Tween.TweenType slideOutTweenType
		{
			get
			{
				return m_SlideOutTweenType;
			}
			set
			{
				m_SlideOutTweenType = value;
			}
		}

		public ScreenView.SlideDirection slideOutDirection
		{
			get
			{
				return m_SlideOutDirection;
			}
			set
			{
				m_SlideOutDirection = value;
			}
		}

		public bool autoSlideOutAmount
		{
			get
			{
				return m_AutoSlideOutAmount;
			}
			set
			{
				m_AutoSlideOutAmount = value;
			}
		}

		public float slideOutAmount
		{
			get
			{
				return m_SlideOutAmount;
			}
			set
			{
				m_SlideOutAmount = value;
			}
		}

		public float slideOutPercent
		{
			get
			{
				return m_SlideOutPercent;
			}
			set
			{
				m_SlideOutPercent = value;
			}
		}

		public AnimationCurve slideOutCustomCurve
		{
			get
			{
				return m_SlideOutCustomCurve;
			}
			set
			{
				m_SlideOutCustomCurve = value;
			}
		}

		public bool rippleOut
		{
			get
			{
				return m_RippleOut;
			}
			set
			{
				m_RippleOut = value;
			}
		}

		public Tween.TweenType rippleOutTweenType
		{
			get
			{
				return m_RippleOutTweenType;
			}
			set
			{
				m_RippleOutTweenType = value;
			}
		}

		public ScreenView.RippleType rippleOutType
		{
			get
			{
				return m_RippleOutType;
			}
			set
			{
				m_RippleOutType = value;
			}
		}

		public Vector2 rippleOutPosition
		{
			get
			{
				return m_RippleOutPosition;
			}
			set
			{
				m_RippleOutPosition = value;
			}
		}

		public AnimationCurve rippleOutCustomCurve
		{
			get
			{
				return m_RippleOutCustomCurve;
			}
			set
			{
				m_RippleOutCustomCurve = value;
			}
		}

		public float transitionDuration
		{
			get
			{
				return m_TransitionDuration;
			}
			set
			{
				m_TransitionDuration = value;
			}
		}

		private RectTransform ripple
		{
			get
			{
				if (m_Ripple == null)
				{
					m_Ripple = new GameObject("Ripple Mask", typeof(VectorImage)).GetComponent<RectTransform>();
					m_Ripple.GetComponent<VectorImage>().vectorImageData = MaterialUIIconHelper.GetIcon("circle").vectorImageData;
					m_Ripple.SetParent(rectTransform.parent);
					m_Ripple.localScale = Vector3.one;
					m_Ripple.gameObject.AddComponent<Mask>().showMaskGraphic = false;
					m_Ripple.sizeDelta = Vector2.zero;
					m_Ripple.position = GetRipplePosition();
				}
				return m_Ripple;
			}
		}

		public ScreenView screenView
		{
			get
			{
				if (m_ScreenView == null)
				{
					m_ScreenView = GetComponentInParent<ScreenView>();
				}
				return m_ScreenView;
			}
		}

		public RectTransform rectTransform
		{
			get
			{
				if (m_RectTransform == null)
				{
					m_RectTransform = base.gameObject.GetComponent<RectTransform>();
				}
				return m_RectTransform;
			}
		}

		public CanvasGroup canvasGroup
		{
			get
			{
				if (m_CanvasGroup == null)
				{
					m_CanvasGroup = base.gameObject.GetAddComponent<CanvasGroup>();
					m_CanvasGroup.blocksRaycasts = true;
					m_CanvasGroup.interactable = true;
					m_CanvasGroup.ignoreParentGroups = true;
				}
				return m_CanvasGroup;
			}
		}

		public int screenIndex
		{
			get
			{
				return m_ScreenIndex;
			}
			set
			{
				m_ScreenIndex = value;
			}
		}

		private void CheckValues()
		{
			if (optionsControlledByScreenView)
			{
				fadeIn = screenView.fadeIn;
				fadeInTweenType = screenView.fadeInTweenType;
				fadeInAlpha = screenView.fadeInAlpha;
				fadeInCustomCurve = screenView.fadeInCustomCurve;
				scaleIn = screenView.scaleIn;
				scaleInTweenType = screenView.scaleInTweenType;
				scaleInScale = screenView.scaleInScale;
				scaleInCustomCurve = screenView.scaleInCustomCurve;
				slideIn = screenView.slideIn;
				slideInTweenType = screenView.slideInTweenType;
				slideInDirection = screenView.slideInDirection;
				autoSlideInAmount = screenView.autoSlideInAmount;
				slideInAmount = screenView.slideInAmount;
				slideInPercent = screenView.slideInPercent;
				slideInCustomCurve = screenView.slideInCustomCurve;
				rippleIn = screenView.rippleIn;
				rippleInTweenType = screenView.rippleInTweenType;
				rippleInType = screenView.rippleInType;
				rippleInPosition = screenView.rippleInPosition;
				rippleInCustomCurve = screenView.rippleInCustomCurve;
				fadeOut = screenView.fadeOut;
				fadeOutTweenType = screenView.fadeOutTweenType;
				fadeOutAlpha = screenView.fadeOutAlpha;
				fadeOutCustomCurve = screenView.fadeOutCustomCurve;
				scaleOut = screenView.scaleOut;
				scaleOutTweenType = screenView.scaleOutTweenType;
				scaleOutScale = screenView.scaleOutScale;
				scaleOutCustomCurve = screenView.scaleOutCustomCurve;
				slideOut = screenView.slideOut;
				slideOutTweenType = screenView.slideOutTweenType;
				slideOutDirection = screenView.slideOutDirection;
				autoSlideOutAmount = screenView.autoSlideOutAmount;
				slideOutAmount = screenView.slideOutAmount;
				slideOutPercent = screenView.slideOutPercent;
				slideOutCustomCurve = screenView.slideOutCustomCurve;
				rippleOut = screenView.rippleOut;
				rippleOutTweenType = screenView.rippleOutTweenType;
				rippleOutType = screenView.rippleOutType;
				rippleOutPosition = screenView.rippleOutPosition;
				rippleOutCustomCurve = screenView.rippleOutCustomCurve;
				transitionDuration = screenView.transitionDuration;
			}
		}

		private void SetupRipple()
		{
			ripple.sizeDelta = Vector2.zero;
			m_CurrentRipplePos = GetRipplePosition();
			m_TargetRipplePos = GetRippleTargetPosition();
			m_TempRippleSize = GetRippleTargetSize();
			ripple.gameObject.SetActive(value: true);
		}

		public void TransitionIn()
		{
			CheckValues();
			canvasGroup.interactable = true;
			canvasGroup.blocksRaycasts = true;
			base.gameObject.SetActive(value: true);
			m_TempScreenPos = rectTransform.position;
			if (rippleIn)
			{
				if (screenView.graphicRaycaster == null)
				{
					screenView.graphicRaycaster = screenView.GetAddComponent<GraphicRaycaster>();
				}
				if (screenView.canvas == null)
				{
					screenView.canvas = screenView.GetAddComponent<Canvas>();
				}
				screenView.canvas.overridePixelPerfect = true;
				screenView.canvas.pixelPerfect = false;
				SetupRipple();
				ripple.SetSiblingIndex(rectTransform.GetSiblingIndex());
				Vector2 properSize = rectTransform.GetProperSize();
				rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
				rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
				m_TempRippleScale = rectTransform.localScale;
				rectTransform.SetParent(ripple, worldPositionStays: true);
				rectTransform.sizeDelta = properSize;
			}
			if (fadeIn)
			{
				canvasGroup.alpha = fadeInAlpha;
			}
			if (scaleIn)
			{
				rectTransform.localScale = new Vector3(scaleInScale, scaleInScale, scaleInScale);
			}
			if (slideIn)
			{
				if (autoSlideInAmount)
				{
					if (slideInDirection == ScreenView.SlideDirection.Up || slideInDirection == ScreenView.SlideDirection.Down)
					{
						Vector2 properSize2 = rectTransform.GetProperSize();
						slideInAmount = properSize2.y * slideInPercent * 0.01f;
					}
					else
					{
						Vector2 properSize3 = rectTransform.GetProperSize();
						slideInAmount = properSize3.x * slideInPercent * 0.01f;
					}
				}
				switch (slideInDirection)
				{
				case ScreenView.SlideDirection.Left:
					rectTransform.position = new Vector2(m_TempScreenPos.x - slideInAmount, m_TempScreenPos.y);
					break;
				case ScreenView.SlideDirection.Right:
					rectTransform.position = new Vector2(m_TempScreenPos.x + slideInAmount, m_TempScreenPos.y);
					break;
				case ScreenView.SlideDirection.Up:
					rectTransform.position = new Vector2(m_TempScreenPos.x, m_TempScreenPos.y + slideInAmount);
					break;
				case ScreenView.SlideDirection.Down:
					rectTransform.position = new Vector2(m_TempScreenPos.x, m_TempScreenPos.y - slideInAmount);
					break;
				}
				m_SlideScreenPos = rectTransform.position;
			}
			m_IsTransitioning = 1;
			m_TransitionStartTime = Time.realtimeSinceStartup;
		}

		public void TransitionOut()
		{
			CheckValues();
			canvasGroup.interactable = false;
			canvasGroup.blocksRaycasts = false;
			m_TempScreenPos = rectTransform.position;
			if (rippleOut)
			{
				if (screenView.graphicRaycaster == null)
				{
					screenView.graphicRaycaster = screenView.GetAddComponent<GraphicRaycaster>();
				}
				if (screenView.canvas == null)
				{
					screenView.canvas = screenView.GetAddComponent<Canvas>();
				}
				screenView.canvas.overridePixelPerfect = true;
				screenView.canvas.pixelPerfect = false;
				SetupRipple();
				m_TempRippleSize = GetRippleTargetSize();
				ripple.sizeDelta = m_TempRippleSize;
				ripple.anchoredPosition = Vector2.zero;
				ripple.SetSiblingIndex(rectTransform.GetSiblingIndex());
				Vector2 properSize = rectTransform.GetProperSize();
				rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
				rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
				m_TempRippleScale = rectTransform.localScale;
				rectTransform.SetParent(ripple, worldPositionStays: true);
				rectTransform.sizeDelta = properSize;
			}
			if (fadeOut)
			{
				canvasGroup.alpha = 1f;
			}
			if (scaleOut)
			{
				rectTransform.localScale = new Vector3(1f, 1f, 1f);
			}
			if (slideOut)
			{
				if (autoSlideOutAmount)
				{
					if (slideOutDirection == ScreenView.SlideDirection.Up || slideOutDirection == ScreenView.SlideDirection.Down)
					{
						Vector2 properSize2 = rectTransform.GetProperSize();
						slideOutAmount = properSize2.y * slideOutPercent * 0.01f;
					}
					else
					{
						Vector2 properSize3 = rectTransform.GetProperSize();
						slideOutAmount = properSize3.x * slideOutPercent * 0.01f;
					}
				}
				switch (slideOutDirection)
				{
				case ScreenView.SlideDirection.Left:
					m_SlideScreenPos = new Vector2(m_TempScreenPos.x - slideOutAmount, m_TempScreenPos.y);
					break;
				case ScreenView.SlideDirection.Right:
					m_SlideScreenPos = new Vector2(m_TempScreenPos.x + slideOutAmount, m_TempScreenPos.y);
					break;
				case ScreenView.SlideDirection.Up:
					m_SlideScreenPos = new Vector2(m_TempScreenPos.x, m_TempScreenPos.y + slideOutAmount);
					break;
				case ScreenView.SlideDirection.Down:
					m_SlideScreenPos = new Vector2(m_TempScreenPos.x, m_TempScreenPos.y - slideOutAmount);
					break;
				}
			}
			m_IsTransitioning = 2;
			m_TransitionStartTime = Time.realtimeSinceStartup;
		}

		public void TransitionOutWithoutTransition()
		{
			m_IsTransitioning = 3;
			m_TransitionStartTime = Time.realtimeSinceStartup;
		}

		private void Update()
		{
			if (m_IsTransitioning <= 0)
			{
				return;
			}
			m_TransitionDeltaTime = Time.realtimeSinceStartup - m_TransitionStartTime;
			if (m_TransitionDeltaTime <= transitionDuration)
			{
				if (m_IsTransitioning == 1)
				{
					if (rippleIn)
					{
						Vector3 position = m_Ripple.position;
						position.x = Tween.Evaluate(rippleInTweenType, m_CurrentRipplePos.x, m_TargetRipplePos.x, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						position.y = Tween.Evaluate(rippleInTweenType, m_CurrentRipplePos.y, m_TargetRipplePos.y, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						position.z = Tween.Evaluate(rippleInTweenType, m_CurrentRipplePos.z, m_TargetRipplePos.z, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						m_Ripple.position = position;
						Vector2 sizeDelta = m_Ripple.sizeDelta;
						sizeDelta.x = Tween.Evaluate(rippleInTweenType, 0f, m_TempRippleSize.x, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						sizeDelta.y = Tween.Evaluate(rippleInTweenType, 0f, m_TempRippleSize.y, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						m_Ripple.sizeDelta = sizeDelta;
						this.rectTransform.position = m_TempScreenPos;
						RectTransform rectTransform = this.rectTransform;
						float x = m_TempRippleScale.x;
						Vector3 localScale = ripple.localScale;
						float x2 = x / localScale.x;
						float y = m_TempRippleScale.y;
						Vector3 localScale2 = ripple.localScale;
						float y2 = y / localScale2.y;
						float z = m_TempRippleScale.z;
						Vector3 localScale3 = ripple.localScale;
						rectTransform.localScale = new Vector3(x2, y2, z / localScale3.z);
					}
					if (fadeIn)
					{
						canvasGroup.alpha = Tween.Evaluate(fadeInTweenType, fadeInAlpha, 1f, m_TransitionDeltaTime, transitionDuration, fadeInCustomCurve);
					}
					if (scaleIn)
					{
						Vector3 localScale4 = this.rectTransform.localScale;
						localScale4.x = Tween.Evaluate(scaleInTweenType, scaleInScale, 1f, m_TransitionDeltaTime, transitionDuration, scaleInCustomCurve);
						localScale4.y = localScale4.x;
						localScale4.z = localScale4.x;
						this.rectTransform.localScale = localScale4;
					}
					if (slideIn)
					{
						Vector3 position2 = this.rectTransform.position;
						position2.x = Tween.Evaluate(slideInTweenType, m_SlideScreenPos.x, m_TempScreenPos.x, m_TransitionDeltaTime, transitionDuration, slideInCustomCurve);
						position2.y = Tween.Evaluate(slideInTweenType, m_SlideScreenPos.y, m_TempScreenPos.y, m_TransitionDeltaTime, transitionDuration, slideInCustomCurve);
						this.rectTransform.position = position2;
					}
				}
				else if (m_IsTransitioning == 2)
				{
					if (rippleOut)
					{
						Vector3 position3 = m_Ripple.position;
						position3.x = Tween.Evaluate(rippleInTweenType, m_CurrentRipplePos.x, m_TargetRipplePos.x, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						position3.y = Tween.Evaluate(rippleInTweenType, m_CurrentRipplePos.y, m_TargetRipplePos.y, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						position3.z = Tween.Evaluate(rippleInTweenType, m_CurrentRipplePos.z, m_TargetRipplePos.z, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						m_Ripple.position = position3;
						Vector2 sizeDelta2 = m_Ripple.sizeDelta;
						sizeDelta2.x = Tween.Evaluate(rippleInTweenType, m_TempRippleSize.x, 0f, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						sizeDelta2.y = Tween.Evaluate(rippleInTweenType, m_TempRippleSize.y, 0f, m_TransitionDeltaTime, m_TransitionDuration, rippleInCustomCurve);
						m_Ripple.sizeDelta = sizeDelta2;
						this.rectTransform.position = m_TempScreenPos;
						RectTransform rectTransform2 = this.rectTransform;
						float x3 = m_TempRippleScale.x;
						Vector3 localScale5 = ripple.localScale;
						float x4 = x3 / localScale5.x;
						float y3 = m_TempRippleScale.y;
						Vector3 localScale6 = ripple.localScale;
						float y4 = y3 / localScale6.y;
						float z2 = m_TempRippleScale.z;
						Vector3 localScale7 = ripple.localScale;
						rectTransform2.localScale = new Vector3(x4, y4, z2 / localScale7.z);
					}
					if (fadeOut)
					{
						canvasGroup.alpha = Tween.Evaluate(fadeOutTweenType, 1f, fadeOutAlpha, m_TransitionDeltaTime, transitionDuration, fadeOutCustomCurve);
					}
					if (scaleOut)
					{
						Vector3 localScale8 = this.rectTransform.localScale;
						localScale8.x = Tween.Evaluate(scaleOutTweenType, 1f, scaleOutScale, m_TransitionDeltaTime, transitionDuration, scaleOutCustomCurve);
						localScale8.y = localScale8.x;
						localScale8.z = localScale8.x;
						this.rectTransform.localScale = localScale8;
					}
					if (slideOut)
					{
						Vector3 position4 = this.rectTransform.position;
						position4.x = Tween.Evaluate(slideOutTweenType, m_TempScreenPos.x, m_SlideScreenPos.x, m_TransitionDeltaTime, transitionDuration, slideOutCustomCurve);
						position4.y = Tween.Evaluate(slideOutTweenType, m_TempScreenPos.y, m_SlideScreenPos.y, m_TransitionDeltaTime, transitionDuration, slideOutCustomCurve);
						this.rectTransform.position = position4;
					}
				}
				return;
			}
			if (m_IsTransitioning == 1)
			{
				if (rippleIn)
				{
					this.rectTransform.SetParent(screenView.transform, worldPositionStays: true);
					this.rectTransform.position = m_TempScreenPos;
					this.rectTransform.anchorMin = Vector2.zero;
					this.rectTransform.anchorMax = Vector2.one;
					this.rectTransform.sizeDelta = Vector2.zero;
					this.rectTransform.anchoredPosition = Vector2.zero;
					this.rectTransform.localScale = m_TempRippleScale;
					ripple.gameObject.SetActive(value: false);
				}
				if (fadeIn)
				{
					canvasGroup.alpha = 1f;
				}
				if (scaleIn)
				{
					this.rectTransform.localScale = new Vector3(1f, 1f, 1f);
				}
				if (slideIn)
				{
					this.rectTransform.position = m_TempScreenPos;
				}
			}
			else if (m_IsTransitioning == 2)
			{
				if (rippleOut)
				{
					this.rectTransform.SetParent(screenView.transform, worldPositionStays: true);
					this.rectTransform.position = m_TempScreenPos;
					this.rectTransform.anchorMin = Vector2.zero;
					this.rectTransform.anchorMax = Vector2.one;
					this.rectTransform.sizeDelta = Vector2.zero;
					this.rectTransform.anchoredPosition = Vector2.zero;
					this.rectTransform.localScale = m_TempRippleScale;
					ripple.gameObject.SetActive(value: false);
				}
				if (fadeOut)
				{
					canvasGroup.alpha = 1f;
				}
				if (scaleOut)
				{
					this.rectTransform.localScale = new Vector3(1f, 1f, 1f);
				}
				if (slideOut)
				{
					this.rectTransform.position = m_TempScreenPos;
				}
			}
			if (m_IsTransitioning > 1 && m_DisableWhenNotVisible)
			{
				base.gameObject.SetActive(value: false);
			}
			m_IsTransitioning = 0;
			screenView.OnScreenEndTransition(screenIndex);
		}

		private Vector2 GetRipplePosition()
		{
			switch (m_RippleInType)
			{
			case ScreenView.RippleType.Manual:
				return m_RippleInPosition;
			case ScreenView.RippleType.Center:
			{
				Vector3 positionRegardlessOfPivot = rectTransform.GetPositionRegardlessOfPivot();
				float x = positionRegardlessOfPivot.x;
				Vector2 sizeDelta = rectTransform.sizeDelta;
				float x2 = x + sizeDelta.x * 0.5f;
				float y = positionRegardlessOfPivot.y;
				Vector2 sizeDelta2 = rectTransform.sizeDelta;
				return new Vector2(x2, y + sizeDelta2.y * 0.5f);
			}
			default:
				return UnityEngine.Input.mousePosition;
			}
		}

		private Vector2 GetRippleTargetSize()
		{
			Vector2 properSize = rectTransform.GetProperSize();
			properSize.x *= properSize.x;
			properSize.y *= properSize.y;
			properSize.x = Mathf.Sqrt(properSize.x + properSize.y);
			properSize.y = properSize.x;
			return properSize;
		}

		private Vector3 GetRippleTargetPosition()
		{
			return rectTransform.GetPositionRegardlessOfPivot();
		}

		public void Interrupt()
		{
			if (m_IsTransitioning == 1)
			{
				if (rippleIn)
				{
					rectTransform.SetParent(screenView.transform, worldPositionStays: true);
					rectTransform.position = m_TempScreenPos;
					rectTransform.anchorMin = Vector2.zero;
					rectTransform.anchorMax = Vector2.one;
					rectTransform.sizeDelta = Vector2.zero;
					rectTransform.anchoredPosition = Vector2.zero;
					ripple.gameObject.SetActive(value: false);
				}
				if (fadeIn)
				{
					canvasGroup.alpha = 1f;
				}
				if (scaleIn)
				{
					rectTransform.localScale = new Vector3(1f, 1f, 1f);
				}
				if (slideIn)
				{
					rectTransform.position = m_TempScreenPos;
				}
			}
			else if (m_IsTransitioning == 2)
			{
				if (rippleOut)
				{
					rectTransform.SetParent(screenView.transform, worldPositionStays: true);
					rectTransform.position = m_TempScreenPos;
					rectTransform.anchorMin = Vector2.zero;
					rectTransform.anchorMax = Vector2.one;
					rectTransform.sizeDelta = Vector2.zero;
					rectTransform.anchoredPosition = Vector2.zero;
					ripple.gameObject.SetActive(value: false);
				}
				if (fadeOut)
				{
					canvasGroup.alpha = 1f;
				}
				if (scaleOut)
				{
					rectTransform.localScale = new Vector3(1f, 1f, 1f);
				}
				if (slideOut)
				{
					rectTransform.position = m_TempScreenPos;
				}
			}
			if (m_IsTransitioning > 1 && m_DisableWhenNotVisible)
			{
				base.gameObject.SetActive(value: false);
			}
			if (m_IsTransitioning > 0)
			{
				m_IsTransitioning = 0;
				screenView.OnScreenEndTransition(screenIndex);
			}
		}
	}
}
